@isTest
private class testActivitySearchController {    
    static testMethod void myUnitTest() {
    
        Profile p = [Select id from Profile where Name = 'Customer Care'];
        User u = [Select id,accountid from User where ProfileId = :p.id AND IsActive = true LIMIT 1];
        Account a = [Select id from Account WHERE RecordType.name = 'Booked Account' LIMIT 1];
        Contact c = [Select id from Contact where Accountid = :a.id];
        system.debug('user details: '+u.id);
        system.debug('user acc: '+u.accountid);
        ActivitySearchController ext;
        Task t;
        System.runAs(u){
            t = new task();
            t.Subject='Test Object 1';
            t.Query_Type__c='Payment Related';
            t.Status='open';
            t.Priority='Normal';
            insert t;
            
            PageReference pageRef = Page.searchActivities;
            Test.setCurrentPage(pageRef);
            ApexPages.currentPage().getParameters().put('accid', a.id);
            ApexPages.currentPage().getParameters().put('subject', 'email');
            ApexPages.currentPage().getParameters().put('queryType', 'Payment');
            ApexPages.currentPage().getParameters().put('querySubtype', 'Payment');

            ActivitySearchController ActivitySearchControllerobj = new ActivitySearchController();
            ActivitySearchControllerobj.toggleSort();
            ActivitySearchControllerobj.runQuery();
            ActivitySearchControllerobj.runSearch();
            ActivitySearchControllerobj.contid = c.id;
            
            ApexPages.StandardController con = new ApexPages.StandardController(t);
            ext = new ActivitySearchController(con);
            
        }
    }
}